<?php 
//หาจำนวนวัน
function DateDiff($strDate1,$strDate2)
{
	return (strtotime($strDate2) - strtotime($strDate1))/  ( 60 * 60 * 24 );  // 1 day = 60*60*24
}

//แสดง active เน้นเมนูที่เลือก
function active_menu($link_chk,$default_active=0){
	if($default_active==1){
		return ($_SERVER['REQUEST_URI']==$link_chk || $_SERVER['QUERY_STRING']=="")?"Now":"";
	}else{
		return ($_SERVER['REQUEST_URI']==$link_chk)?"Now":"";
	}
}

//แสดงเป็นค่าเงิน เช่น 1,000.00
function bath_format($number){
	return number_format($number,2,'.',',');
}

//แสดงรูป header ตามวัน
function BgHead($week)
{	
	switch($week){
		case 0:
			$i = "topBG_01.png";
			break;
		case 1:
			$i = "topBG_02.png";
			break;
		case 2:
			$i = "topBG_03.png";
			break;
		case 3:
			$i = "topBG_04.png";
			break;
		case 4:
			$i = "topBG_05.png";
			break;
		case 5:
			$i = "topBG_06.png";
			break;
		case 6:
			$i = "topBG_07.png";
			break;		
	}
	
	return $i;
}

//แสดงสีหัวข้อตามวัน
function HeadColor($week){
	switch($week){
		case 0:
			$i = "#FF0000";
			break;
		case 1:
			$i = "#FFD149";
			break;
		case 2:
			$i = "#FA42A2";
			break;
		case 3:
			$i = "#61C419";
			break;
		case 4:
			$i = "#FF8E25";
			break;
		case 5:
			$i = "#44C5ED";
			break;
		case 6:
			$i = "#CA5EC9";
			break;		
	}
	
	return $i;	
}
?>
